{extend name="common@list" /}
{block name="topnav"}
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页
		<span class="c-gray en">&gt;</span> 成绩管理
		<span class="c-gray en">&gt;</span> 成绩列表
		<a class="btn btn-success radius r"
			style="line-height:1.6em;margin-top:3px"
			href="javascript:location.replace(location.href);"
			title="刷新" >
			<i class="Hui-iconfont">&#xe68f;</i>
	</a>
	</nav>
{/block}
{block name="bouttons"}
	<div class="panel panel-default mt-10 mb-10">
		<div class="panel-header" id="shaixuan">筛选</div>
		<div class="panel-body" style="min-height: 60px">
				<div>
					{php}
						$school = schlist('校级','校级');
					{/php}
					<label class="f-l">学校：</label>
					<dt>
						<dd class=" mt-10">
							{foreach $school as $key=>$vo } 
							<label class="ml-10">
								<input type="checkbox" value="{$vo.id}" name="school" onclick="dtreload()">
								{$vo.jiancheng}
							</label>
						{/foreach}
						</dd>
					</dt>
				</div>
				<div>
					{php}
						$njlist = nianjiList();
					{/php}
					<label class="f-l">年级：</label>
					{foreach $njlist as $key=>$vo } 
						<div class="radio-box f-l">
							<input name="sex" type="radio" id="nj-{$key}" value="{$key}" name="nianji" onclick="dtreload()">
							<label for="nj-{$key}">{$vo}</label>
						</div>
					{/foreach}

				</div>
		</div>
	</div>

{/block}
{block name="tables"}
	<table id="table1" class="display" cellspacing="0" width="100%">
		<thead>
			<tr>
				<th rowspan="2">序号</th>
				<th rowspan="2">班级</th>
				<th class="text-c" colspan="4" style="border: 0px;">语文</th>
				<th class="text-c" colspan="4" style="border: 0px;">数学</th>
				<th class="text-c" colspan="4" style="border: 0px;">英语</th>
			</tr>
			<tr>
				<th>人数</th>
				<th>平均分</th>
				<th>优秀率%</th>
				<th>及格率%</th>

				<th>人数</th>
				<th>平均分</th>
				<th>优秀率%</th>
				<th>及格率%</th>

				<th>人数</th>
				<th>平均分</th>
				<th>优秀率%</th>
				<th>及格率%</th>
			</tr>
		</thead>
		<tbody>
		</tbody>
	</table>


{/block}
{block name="myjs"}
<script type="text/javascript">

	// 定义DTajax参数
	var myajax = {
		url: "{:url('ajaxNianji')}",
		type: "post",
		data: {
			kaoshiid:"{$list.kaoshi}",
			school:function(){
				var chk = [];
				$('input[name="school"]:checked').each(function(){
					if(typeof($(this).val()) != "undefined")
					{
						chk.push($(this).val());
					}
				});
				return chk;
			},
			ruxuenian:function(){
				var a = $('input:radio:checked').val();
				// if(typeof(a) == "undefined")
				// {
				// 	var date=new Date;
				// 	a = date.getFullYear()-1; 
				// }
				return a;
			},			
		},
	};

	// 定义列参数
	var mycolumns = [
        { "data": "id" },
        { "data": "title" },

        { "data": "data.yuwen.cnt","defaultContent": "" },
        { "data": "data.yuwen.avg","defaultContent": "" },
        { "data": "data.yuwen.youxiu" ,"defaultContent": ""},
        { "data": "data.yuwen.jige","defaultContent": "" },

        { "data": "data.shuxue.cnt" ,"defaultContent": ""},
        { "data": "data.shuxue.avg","defaultContent": "" },
        { "data": "data.shuxue.youxiu","defaultContent": "" },
        { "data": "data.shuxue.jige","defaultContent": "" },

        { "data": "data.waiyu.cnt","defaultContent": "" },
        { "data": "data.waiyu.avg","defaultContent": "" },
        { "data": "data.waiyu.youxiu","defaultContent": "" },
        { "data": "data.waiyu.jige","defaultContent": "" },
        
	];

		// 定义修改列参数
	var mycolumnDefs =[
		// 对象格式
        {
        	"orderable": false,
        	"targets": [0,1,2,3,4,5,6,7,8,9,10,11,12,13]
        }, 
	];


	// 筛选成绩面板折叠
	$('#shaixuan').click(function(){
		$(this).next().toggle();
	});

	// 重载数据
	function dtreload()
	{
		mytable.ajax.reload();
	}

	
</script>
{/block}